package com.mz.ozy.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;


import com.mz.ozy.R;

import butterknife.BindView;
import butterknife.ButterKnife;

public class BuyHYTypeAdapter extends BaseAdapter {


    private Context mContext;
    private int selectPosition = 0;

    //    List<AssetsBean.KlistBean> mKlistBeans;
    public BuyHYTypeAdapter(Context context/*, List<AssetsBean.KlistBean> mKlistBeans*/) {
        this.mContext = context;
//        this.mKlistBeans = mKlistBeans;

    }

    public int getSelectPosition() {
        return selectPosition;
    }

    public void setSelectPosition(int selectPosition) {
        this.selectPosition = selectPosition;
        notifyDataSetChanged();
    }

    @Override
    public int getCount() {
//        return mKlistBeans.size();
        return 0;
    }

    @Override
    public Object getItem(int position) {
        return position;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.item_buy_hy_type, null);
            holder = new ViewHolder(convertView);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
//        AssetsBean.KlistBean bean = mKlistBeans.get(position);
//        holder.mTvType.setText(bean.getAmount()+"QC");
        if (selectPosition == position) {
            holder.mTvType.setBackgroundResource(R.drawable.bt_round_bule_2);
        } else {
            holder.mTvType.setBackgroundResource(R.drawable.bt_round_ccc_2);

        }

        return convertView;
    }


    class ViewHolder {
        @BindView(R.id.tv_type)
        TextView mTvType;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
